package com.itheima.mapper;

import com.itheima.pojo.entity.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckItemMapper {

    @Insert("insert into t_checkitem(code, name, sex, age, price, type, attention, remark) values (#{code}, #{name}, #{sex}, #{age}, #{price}, #{type}, #{attention}, #{remark})")
    void addCheckItem(CheckItem checkItem);

    @Delete("DELETE FROM t_checkitem WHERE id = #{id}")
    void deleteCheckItemById(Integer id);

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id=#{id}")
    Integer[] findCheckItemIdsByCheckGroupId(Integer id);

    void updateCheckItem(CheckItem checkItem);

    @Select("SELECT * FROM t_checkitem")
    List<CheckItem> selectAllCheckItem();

    @Select("SELECT * FROM t_checkitem WHERE id = #{id}")
    CheckItem findByIdCheckItem(Integer id);
}